import api from '@/api/index.js'
import {refreshTokenPost} from '@/api/refreshToken.js'

const url = '/setting/chart/'
// 查询列表
export function ChartListGet(params) {
  refreshTokenPost(api)
  return api({
    url: url + 'chartlist/',
    method: 'get',
    params: params,
  })
}

// 新增
export function ChartListPost(data) {
  return api({
    url: url + 'chartlist/',
    method: 'post',
    data: data,
  })
}


// 查询单个
export function ChartPkGet(pk) {
  return api({
    url: url + 'chartpk/' + pk + '/',
    method: 'get',
  })
}

export function ChartPkPost(data,pk) {
  return api({
    url: url + 'chartpk/' + pk + '/',
    method: 'post',
    data: data,
  })
}
// 修改
export function ChartPkPut(data,pk) {
  return api({
    url: url + 'chartpk/' + pk + '/',
    method: 'put',
    data: data,
  })
}

// 删除
export function ChartPkDelete(pk) {
  return api({
    url: url + 'chartpk/' + pk + '/',
    method: 'delete',
  })
}


// 查询大屏预览数据
export function ChartGetDataListPost(data) {
  return api({
    url: url + 'chartgetdatalistview/',
    method: 'post',
    data: data
  })
}

// 数据中心查询数据
export function ChartDataListGet(params) {
  refreshTokenPost(api)
  return api({
    url: url + 'chartdatalist/',
    method: 'get',
    params: params,
  })
}
// 数据中心新增数据
export function ChartDataListPost(data) {
  refreshTokenPost(api)
  return api({
    url: url + 'chartdatalist/',
    method: 'post',
    data: data,
  })
}

// 数据中心删除数据
export function ChartDataPkDelete(pk) {
  return api({
    url: url + 'chartdatapk/' + pk + '/',
    method: 'delete',
  })
}

// 数据中心查询单个
export function ChartDataPkGet(pk) {
  return api({
    url: url + 'chartdatapk/' + pk + '/',
    method: 'get',
  })
}

// 数据中心查询单个
export function ChartDataPkPut(data,pk) {
  return api({
    url: url + 'chartdatapk/' + pk + '/',
    method: 'put',
    data:data
  })
}